package com.oet.persistence.entity;

// Generated Feb 6, 2010 3:22:38 PM by Hibernate Tools 3.2.4.GA

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.JoinTable;
import javax.persistence.Lob;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;


/**
 * YdkAccount generated by hbm2java
 */
@Entity
@Table(name = "course_series", catalog = "oet")
public class CourseSeries implements java.io.Serializable {

	private Long id;
	private String name;
	private Category category;
	private Integer level;
	private Integer courseNumber;
	private Teacher teacher;
	private Integer capacity;
	private Integer occupyNum;
	private Date startDate;
	private Date endDate;
	private Date lastModified;
	private Double score;
	private Integer scoredNumber;
	
	private Boolean isActived;
	private Integer attribute0;
	private Double totalPrice;
	private String description;
	
	private Integer weekdayFlag;
	private Integer timeFlag;
	
	public static final int WEEKDAY_FLAG_MON = 1;
	public static final int WEEKDAY_FLAG_TUE = 2;
	public static final int WEEKDAY_FLAG_WED = 3;
	public static final int WEEKDAY_FLAG_THU = 4;
	public static final int WEEKDAY_FLAG_FRI = 5;
	public static final int WEEKDAY_FLAG_SAT = 6;
	public static final int WEEKDAY_FLAG_SUN = 7;
	public static final int WEEKDAY_FLAG_WEEKDAY = 8;
	public static final int WEEKDAY_FLAG_WEEKEND = 9;
	public static final int WEEKDAY_FLAG_ALL = 10;
	
	public static final int TIME_FLAG_BEFORENOON = 1;
	public static final int TIME_FLAG_AFTERENOON = 2;
	public static final int TIME_FLAG_NIGHT = 3;
	
	private List<Course> courses = new ArrayList<Course>(0);

	public CourseSeries() {
	}
	

	public CourseSeries(Long id, String name, Category category, Integer level,
			Integer courseNumber, Teacher teacher, Integer capacity,
			Integer occupyNum, Date startDate, Date endDate, Date lastModified,
			Double score, Integer scoredNumber, Boolean isActived,
			Integer attribute0, Double totalPrice, String description,
			Integer weekdayFlag, Integer timeFlag, List<Course> courses) {
		super();
		this.id = id;
		this.name = name;
		this.category = category;
		this.level = level;
		this.courseNumber = courseNumber;
		this.teacher = teacher;
		this.capacity = capacity;
		this.occupyNum = occupyNum;
		this.startDate = startDate;
		this.endDate = endDate;
		this.lastModified = lastModified;
		this.score = score;
		this.scoredNumber = scoredNumber;
		this.isActived = isActived;
		this.attribute0 = attribute0;
		this.totalPrice = totalPrice;
		this.description = description;
		this.weekdayFlag = weekdayFlag;
		this.timeFlag = timeFlag;
		this.courses = courses;
	}






	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "id", unique = true, nullable = false)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}


	@Column(name = "name", nullable = false, length = 250)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}
	
	
	
	@Column(name = "is_actived")
	public Boolean getIsActived() {
		return this.isActived;
	}
	public void setIsActived(Boolean isActived) {
		this.isActived = isActived;
	}

	
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "last_modified")
	public Date getLastModified() {
		return lastModified;
	}
	public void setLastModified(Date lastModified) {
		this.lastModified = lastModified;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "category", nullable=true)
	public Category getCategory() {
		return category;
	}
	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "level")
	public Integer getLevel() {
		return level;
	}
	public void setLevel(Integer level) {
		this.level = level;
	}

	@Column(name = "courseNumber")
	public Integer getCourseNumber() {
		return courseNumber;
	}
	public void setCourseNumber(Integer courseNumber) {
		this.courseNumber = courseNumber;
	}
	
	@ManyToOne(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST})
	@JoinTable(
            name="teacher_course_series",
            joinColumns = @JoinColumn( name="course_series_pk"),
            inverseJoinColumns = @JoinColumn( name="teacher_pk")
    )
	public Teacher getTeacher() {
		return teacher;
	}
	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@Column(name = "description")
	@Lob
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}

	
	@Column(name = "capacity")
	public Integer getCapacity() {
		return capacity;
	}
	public void setCapacity(Integer capacity) {
		this.capacity = capacity;
	}
	
	@Column(name = "occupy_num")
	public Integer getOccupyNum() {
		return occupyNum;
	}
	public void setOccupyNum(Integer occupyNum) {
		this.occupyNum = occupyNum;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "start_date")
	public Date getStartDate() {
		return startDate;
	}
	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "end_date")
	public Date getEndDate() {
		return endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	@Column(name = "score")
	public Double getScore() {
		return score;
	}
	public void setScore(Double score) {
		this.score = score;
	}

	@Column(name = "scored_number")
	public Integer getScoredNumber() {
		return scoredNumber;
	}
	public void setScoredNumber(Integer scoredNumber) {
		this.scoredNumber = scoredNumber;
	}
	
	
	@Column(name = "total_price")
	public Double getTotalPrice() {
		return totalPrice;
	}
	public void setTotalPrice(Double totalPrice) {
		this.totalPrice = totalPrice;
	}


	@Column(name = "attribute0")
	public Integer getAttribute0() {
		return attribute0;
	}
	public void setAttribute0(Integer attribute0) {
		this.attribute0 = attribute0;
	}
	
	
	@Column(name = "weekday_flag")
	public Integer getWeekdayFlag() {
		return weekdayFlag;
	}


	public void setWeekdayFlag(Integer weekdayFlag) {
		this.weekdayFlag = weekdayFlag;
	}

	@Column(name = "time_flag")
	public Integer getTimeFlag() {
		return timeFlag;
	}


	public void setTimeFlag(Integer timeFlag) {
		this.timeFlag = timeFlag;
	}


	@OneToMany(fetch = FetchType.LAZY, mappedBy = "courseSeries")
	@JoinTable(
            name="course_course_series",
            joinColumns = @JoinColumn( name="course_pk"),
            inverseJoinColumns = @JoinColumn( name="course_series_pk")
    )
    @OrderBy("chapterId asc")
	public List<Course> getCourses() {
		return courses;
	}
	public void setCourses(List<Course> courses) {
		this.courses = courses;
	}

	
	
	

	
	
	
	
	

}
